package com.binder.server;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

import com.binder.ICalculateAIDL;

public class CalculateService extends Service {

	private static final String TAG = "CalculateService";

	private final ICalculateAIDL.Stub mBinder = new ICalculateAIDL.Stub() {
		@Override
		public int add(int a, int b) throws RemoteException {
			Log.e(TAG, "add");
			return a + b;
		}

		@Override
		public int minus(int a, int b) throws RemoteException {
			Log.e(TAG, "minus");
			return a - b;
		}
	};

	public CalculateService() {
	}

	@Override
	public void onCreate() {
		Log.e(TAG, "OnCreate");
		super.onCreate();
	}

	@Override
	public int onStartCommand(Intent intent, int flags, int startId) {
		Log.e(TAG, "onStartCommand");
		return super.onStartCommand(intent, flags, startId);
	}

	@Override
	public IBinder onBind(Intent intent) {
		Log.e(TAG, "onBind");
		return mBinder;
	}

	@Override
	public void onDestroy() {
		Log.e(TAG, "onDestroy");
		super.onDestroy();
	}

	@Override
	public boolean onUnbind(Intent intent) {
		Log.e(TAG, "onUnbind");
		return super.onUnbind(intent);
	}

	@Override
	public void onRebind(Intent intent) {
		Log.e(TAG, "onRebind");
		super.onRebind(intent);
	}

}